<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1" xml:lang="en">
  <title id="gi143896">pg_rules</title>
  <body>
    <p>The view <codeph>pg_rules</codeph> provides access to useful information about query rewrite
      rules.</p>
    <p>The <codeph>pg_rules</codeph> view excludes the <codeph>ON SELECT</codeph> rules of views and
      materialized views; those can be seen in <codeph>pg_views</codeph> and
        <codeph>pg_matviews</codeph>.</p>
    <table id="gi143898">
      <title>pg_catalog.pg_rules</title>
      <tgroup cols="4">
        <colspec colnum="1" colname="col1" colwidth="131pt"/>
        <colspec colnum="2" colname="col2" colwidth="75pt"/>
        <colspec colnum="3" colname="col3" colwidth="101.25pt"/>
        <colspec colnum="4" colname="col4" colwidth="147pt"/>
        <thead>
          <row>
            <entry colname="col1">column</entry>
            <entry colname="col2">type</entry>
            <entry colname="col3">references</entry>
            <entry colname="col4">description</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry><codeph>schemaname</codeph></entry>
            <entry>name</entry>
            <entry>pg_namespace.nspname</entry>
            <entry>Name of schema containing table</entry>
          </row>
          <row>
            <entry><codeph>tablename</codeph></entry>
            <entry>name</entry>
            <entry>pg_class.relname</entry>
            <entry>Name of table the rule is for</entry>
          </row>
          <row>
            <entry><codeph>rulename</codeph></entry>
            <entry>name</entry>
            <entry>pg_rewrite.rulename</entry>
            <entry>Name of rule</entry>
          </row>
          <row>
            <entry><codeph>definition</codeph></entry>
            <entry>text</entry>
            <entry> </entry>
            <entry>Rule definition (a reconstructed creation command)</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </body>
</topic>
